class Solution {
public:
    vector<int> path;
    vector<vector<int>> result;
    void dfs(vector<int> &nums, int index) {
        result.push_back(path);
        if (index == nums.size()) return ;
        for (int i = index; i < nums.size(); i++) {
            path.push_back(nums[i]);
            dfs(nums, i + 1);
            path.pop_back();
        }
        return ;
    }
    vector<vector<int>> subsets(vector<int>& nums) {
        dfs(nums, 0);
        return result;
    }
};
